<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>门店首页</title>
  <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
  <meta content="yes" name="apple-mobile-web-app-capable"/>
  <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
  <meta content="telephone=no" name="format-detection"/>
  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="__STATIC__/layer/layer.js"></script>
</head>
<body>
<!--顶部导航区 start-->
<div>
{foreach name="category" item="v1"}
<span>
  <a href="{:url('GoodsList/goods_list')}?cate_id={$v1.id}">{$v1.title}</a>
</span>
{/foreach}
</div>
<!--顶部导航区  end-->
<!--轮播图区 start-->
<div>
{foreach name="banner" item="v2"}
  <img src="{$v2.logo}" width="40px;" height="40px;">
{/foreach}
</div>
<!--轮播图区-->
<!--搜索区 start-->
<div>
  <form action="#" method="post">
      搜索：<input type="text" name="title" value="">
      <input typs="submit" value="提交">
  </form>
</div>
<!--搜索区 end-->
<!--广告位一 start-->
<div>
  <img src="{$advert_1.logo}" style="border:1px solid black;" width="200px;" height="200px;">
</div>
<!--广告位一 end-->

<!--优惠券 start-->
<div>
  {foreach name="coupon" item="v3"}
    <span style="{if condition='$v3.is_receive gt 0'} border:5px solid red; {/if}"><img src="{$v3.img}" width="200px;" height="100px;">￥：   {$v3.reduce}</span>
  {/foreach}
    <a href="{:url('StoreIndex/store_coupon_list')}">更多</a>
</div>
<!--优惠券 end-->
<!--推荐商品一位 start-->
<div style="border:2px solid black;">
    <p><a href="#">更多{$recommend_category_1.title}</a></p>
    {foreach name="$recommend_goods_1" item="v"}
        <p>
            {$v.name}
            <img src="{$v.logo}" width="100px;" height="100px;">
            {foreach name="v['goods_label']" item="vv"}
                {foreach name="goods_label" item="vo"}
                    {if condition="$vv eq $vo.id"}
                          {$vo.title}
                    {/if}
                {/foreach}
            {/foreach}
            ￥：{$v.price}
            <p><a href="#">立即购买</a>&nbsp;&nbsp;<a href="javascript:;" onclick="pre_addto_cart({$v.goods_id});">加入购物车</a></p>
        </p>
    {/foreach}
</div>
<!--推荐商品一位 end-->
<div>
    <img src="{$advert_2.logo}" width="100px;" height="100px;">
</div>
<!--推荐商品二位-->
<div style="border:2px solid black;">
    <p><a href="#">更多{$recommend_category_2.title}</a></p>
    {foreach name="recommend_goods_2" item="v"}
        <p>
            {$v.name}
            <img src="{$v.logo}" width="100px;" height="100px;">
            {foreach name="v['goods_label']" item="vv"}
                  {foreach name="goods_label" item="vo"}
                      {if condition="$vv eq $vo.id"}
                            {$vo.title}
                      {/if}
                  {/foreach}
            {/foreach}
            ￥：{$v.price}
            <p><a href="#">立即购买</a>&nbsp;&nbsp;<a href="javascript:;" onclick="pre_addto_cart({$v.goods_id});">加入购物车</a></p>
        </p>
    {/foreach}
</div>
<!--推荐商品二位-->
</body>
</html>
<script>
    /**
     * 加入购物车
     * @param  id
     */
    function pre_addto_cart(id){
        var objurl = "{:url('GoodsList/pre_addto_cart')}?id="+id;
        layer.open({
            type: 2,
            title: '加入购物车',
            shadeClose: true,
            shade: [0.5, '#666'],
            maxmin: true, //开启最大化最小化按钮
            area: ['600px', '500px'],
            content: objurl
        });
    }
</script>